<?
include '../config.inc.php';
$cp_name_id = $_POST['cp_name_id'];
$name = $_POST['name']; 
$api = 'http://www.x56.co/index.php?c=api&a=updateinfo&cp='.$cp_name_id.'&uptime=1512182825&chtime=605&catid=3&modelid=10';
$resource = file_get_contents( $api );  
$data = json_decode( $resource , 1 );
$qihao = $data['l_t'];
$time = $data['l_d'];
$number = $data['l_r'];
$time_msg = date("H:i:s");
if($qihao ==''){
 echo '本次刷新时间';
 echo $time_msg;
 exit;
}else{  
 echo '采集成功 <br>';
 echo '本次刷新时间';
 echo $time_msg;				
}
//判断是否存在
$num_sql = mysql_query("SELECT * FROM wwk_chat_num WHERE qihao='{$qihao}'");
$num_value = mysql_fetch_array($num_sql);
if($num_value['qihao'] ==''){
   mysql_query("INSERT INTO wwk_chat_num (name , qihao, time, number) VALUES ('$name', '$qihao','$time','$number')");
   mysql_query("INSERT INTO wwk_chat_msg (id,nickname , username, time, msg,img,type,vip) VALUES ('','开奖机器人' , 'report', '$time_msg','彩票名字：{$name}<br><br>开奖时间：{$time}<br><br>开奖期号：{$qihao}<br><br>开奖号码：{$number}<br><br>','/images/vip/report.jpg','2','1')");
}else{

}

?>